package com.fingard.dsp.bank.reqrespobj.balancecheck;

import java.util.HashMap;

import com.fingard.dsp.bank.reqrespobj.ReqRespHeader;
import com.fingard.dsp.bank.reqrespobj.RetAtsBase;
import com.fingard.dsp.bank.reqrespobj.balancecheck.detail.RetAtsBalCheckDetail;
import com.fingard.xml.XmlTextWriter;

public class RetAtsBalCheckQry extends RetAtsBase {
	
	private String actNum;
	public RetAtsBalCheckQry(ReqRespHeader p_header, String pActNum){
		retHeader = p_header;
		actNum = pActNum;
		retXmlWriter = new XmlTextWriter();//用于输出返回ATS的XML报文
	}

	private int writeRdCount = 0;
	public void writeRetDetail(RetAtsBalCheckDetail p_retDetail) throws Exception{
		writeRdCount++;
		if(writeRdCount == 1){
			if(!hasWrittenRespCode){
				writeRespCode("0");
			}
			if(!hasWrittenRespInfo){
				writeRespInfo("");
			}
			retXmlWriter.writeElementString("ActNum", actNum);
		}
		/*
		retXmlWriter.writeStartElement("DetailRecord");
		retXmlWriter.writeElementString("RespCode", p_retDetail.respCode);
		retXmlWriter.writeElementString("RespInfo", p_retDetail.respInfo);
		retXmlWriter.writeElementString("ActCur", p_retDetail.actCur);
		retXmlWriter.writeElementString("ActNum", p_retDetail.actNum);
		retXmlWriter.writeElementString("ActName", p_retDetail.actName);

		retXmlWriter.writeElementString("StatementNumber", p_retDetail.statementNumber);
		retXmlWriter.writeElementString("YearMonth", p_retDetail.yearMonth);
		retXmlWriter.writeElementString("ActBal", p_retDetail.actBal);
		retXmlWriter.writeElementString("AcctType", p_retDetail.acctType);
        retXmlWriter.writeElementString("ActSeq", p_retDetail.actSeq);
		retXmlWriter.writeElementString("BarCode", p_retDetail.actSeq);
		
        retXmlWriter.writeElementString("Prebal", p_retDetail.prebal);

		retXmlWriter.writeElementString("AmountIncurred", p_retDetail.amountIncurred);
		retXmlWriter.writeElementString("DepositNo", p_retDetail.depositNo);
		retXmlWriter.writeElementString("DZFlag", p_retDetail.dzFlag);
		retXmlWriter.writeElementString("CreditNo", p_retDetail.creditNo);
		retXmlWriter.writeElementString("CDFlag", p_retDetail.cdFlag);
		retXmlWriter.writeElementString("Principal", p_retDetail.principal);
		retXmlWriter.writeElementString("InterestMoney", p_retDetail.interestMoney);
		retXmlWriter.writeElementString("DateFrom", p_retDetail.dateFrom);
		retXmlWriter.writeElementString("DateTo", p_retDetail.dateTo);
		retXmlWriter.writeElementString("Memo", p_retDetail.memo);
		
		retXmlWriter.writeEndElement();
		*/
		HashMap<String,String> nameMap = new HashMap<String,String>();
		nameMap.put("cdFlag", "CDFlag");
		nameMap.put("dzFlag", "DZFlag");
		this.writeToXmlDetailRecord(p_retDetail, nameMap, null);
	}
}
